<style>
#message {
    -moz-appearance: textfield-multiline;
    -webkit-appearance: textarea;
    border:1px solid rgb(204, 204, 204);
    font: medium -moz-fixed;
    font: -webkit-small-control;
    height: 179px;
    overflow: auto;
    padding: 2px;
    resize: both;
    width: 494px;
}
.list_item{
 margin-left: -33px;
 padding:5px;
  font: medium -moz-fixed;
  font: -webkit-small-control;
}
.list_itemP{
border-bottom: 2px solid #DDDDDD;
color: #025900;
display: block;
margin: -10px;
padding: 5px;
text-align: center;
}
.list_itemDiv{
	border: 1px solid #DDDDDD;
    float: right;
    margin-left: 100px;
    margin-top: -397px;
    padding: 10px;
    width: 150px;
}
</style>
<div id="contents">
		<div id="header"></div>
    <div class="container-fluid">
		<div class="row-fluid container_bg">
				<div id="sidemenu"></div>
			<div class="span9 pos_r">
				<div class="container_title">
				<form id="newslettrform" method="POST">
						<div class=""><h1>News Letter</h1></div>
						
					<div style="width:800px;">
						<div class="boxMiddle" id="listContent">
							<span id="successmsg" style="color:red" class="adminNewsLetter"></span>
							<div class="tab-content">
								<div id="inline1" class="tab-pane active" style="width:600px; min-height:100px; padding:10px 10px;">
									<div class="PopUp">
										<form enctype="multipart/form-data" id="messageform" name="messageform" method="POST">
												<span id="msg_nr">
													<div class="pad_t8">
														<label>Subject&nbsp;&nbsp;&nbsp;</label><input type="text" id="subject" style="border:1px solid #ccc;height:25px;width:480px" name="subject" value="" /><span id="errorSubject" name="errorSubject" style="color:red"></span>
														<div class="clear hig20">
														</div>
													</div>
												</span>
												</br/>
											<table border="0" cellpadding="0" cellspacing="0" style="margin-right:50px;">
												<tr>			
													<td valign="top"><label>Message&nbsp;&nbsp;&nbsp;</label></td>
													<td> 
														<textarea  id="message" name="message" contenteditable="true" class="editablecontent"></textarea><span id="errorMessage" name="errorMessage" style="color:red"></span>
													</td>			
												</tr>
											</table>
													<div class="pad_t8 pad_1108">&nbsp;
													</div>
												<a href="javascript:void(0);" class="btn btn-success myBtnStyle1" onclick="valid_messageform2();">Save NewsLetter</a>
													<div class="clearBoth">
													</div>
										</form>
									</div>
								</div>
							</div>
						 <div style="clear:both"></div>
						</div> 
					</div>
				</form>	
				</div>
				  
			</div>
		</div>
    </div>
</div>
<script type="text/javascript">
	$(document).ready(function() {
			CKEDITOR.replace( 'message', {
			});
	});
	function valid_messageform2(){
		var flag=true;
		var subject=$('#subject').val();
		if(subject=='')
		{
			$('#errorSubject').html('Subject Should not be empty');
			flag=false;
		}else{
			$('#errorSubject').html("");
		}
		$('textarea[name="message"]').val(CKEDITOR.instances.message.getData());
		var desc=$('#message').val().replace("<p>","");
		desc=desc.replace("</p>","");
		if(desc=="")
		{
			$('#errorMessage').html("news letter msg should not be empty");
			flag=false;
		}else{
			$('#errorMessage').html("");
		}
		if(flag==true){	
			$('#newslettrform').submit();
		}
	}	
	function add_tag(tag){
	  var desc=$('#messageform').find('.nicEdit-main').html();
	  $('#message').val(nicEditors.findEditor('message').getContent());
	  var cdesc=desc+"{"+tag+"}";
	  $('#message').val(nicEditors.findEditor('message').setContent(cdesc));  
   }
</script>

